package com.cscec.omega.config;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * 增删改查
 */
@Aspect
@Component
public class CURDAspect {

    private static Logger logger = LoggerFactory.getLogger(CURDAspect.class);

    @Pointcut("execution(public * com.cscec.omega.service.APIService.save(..))")
    public void pointCutSave(){

    }

    @Around("pointCutSave()")
    public void cutAfter(ProceedingJoinPoint joinPoint){
        try {
            logger.info("save方法返回值: {}", joinPoint.proceed());
        } catch (Throwable throwable) {
            throwable.printStackTrace();
        }
    }
}
